package nels4561;

import java.util.ArrayList;

public class Neuron {
	
	private double out;
	private double sum;
	private ArrayList<Synapse> inSyn;
	
	public Neuron()
	{
		inSyn = new ArrayList<Synapse>();;
		out = 0;
	}
	
	public Neuron(double out)
	{
		this.out = out;
	}
	
	public double sumInputs()
	{
		double sum = 0;
		for (int i = 0; i < inSyn.size(); i++)
		{
			double input = inSyn.get(i).getInOutput();
			double w = inSyn.get(i).getWeight();
			
			sum += input*w; 
		}
		this.sum = sum;
		
		return sum;
	}
	
	public void setOutput()
	{
		sumInputs();
	}
	
	public double getOutput()
	{
		return out;
	}
	
	public void addInputSynapse(Synapse s)
	{
		inSyn.add(s);
	}

}
